﻿function isEmail(string) { if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1){return true;}  return false;}
function CheckRegister()
{    
    var tname; var taddress; var tphone; var temail; var tcity; var tusername; var tpass; var trepass;
    tname=document.getElementById("ctl00_ContentPlaceMain_txthoten").value;
    taddress=document.getElementById("ctl00_ContentPlaceMain_txtdiachi").value;
    tcity=document.getElementById("ctl00_ContentPlaceMain_txtthanhpho").value;
    tphone=document.getElementById("ctl00_ContentPlaceMain_txtdienthoai").value;
    temail=document.getElementById("ctl00_ContentPlaceMain_txtemail").value;
    tusername=document.getElementById("ctl00_ContentPlaceMain_txttendangnhap").value;
    tpass=document.getElementById("ctl00_ContentPlaceMain_txtmatkhau").value;
    trepass=document.getElementById("ctl00_ContentPlaceMain_txtxacnhanmk").value;
    if(tname==''||taddress==''||tcity==''||tphone==''||temail==''||tusername==''||tpass==''||trepass=='')
    {
        alert("Vui lòng cung cấp đầy đủ thông tin.");
        return false;
    }
    if(!isEmail(temail))
    {
        alert("Địa chỉ mail không đúng.");
        return false;
    }
    if(tpass.length<8)
    {
        alert("Mật khẩu có độ dài tối thiểu là 8 ký tự.")
        return false;
    }
     return true;      
}
  $(document).ready(function(){
        $('#ctl00_ContentPlaceMain_btndangky').click(function(){
            CheckRegister();
        });
   });